package com.hk.pinda.zuul.api;

import com.hk.pinda.authority.dto.auth.ResourceQueryDTO;
import com.hk.pinda.authority.entity.auth.Resource;
import com.hk.pinda.base.BaseResult;
import com.hk.pinda.zuul.api.impl.ResourceApiFallbackImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 *  资源API 熔断
 *
 */
@Component
@FeignClient(name = "${pinda.feign.authority-server:hk-auth-server}", fallback = ResourceApiFallbackImpl.class)
public interface ResourceApi {

    /**
     *  获取所有需要鉴权的资源
     *
     * @return
     */
    @GetMapping("/resource/list")
    public BaseResult<List> list();


    /**
     *  查询当前登录用户拥有的资源权限
     *
     * @param resource
     * @return
     */
    @GetMapping("/resource")
    public BaseResult<List<Resource>> visible(ResourceQueryDTO resource);
}
